// 配置路由信息
//引入子路由
export default [
    {
        path:"/home",
        component: () => import('@/pages/Home'),
        meta:{showFooter:true}
    },
    {
        path:"/detail/:skuid",
        component: () => import('@/pages/Detail'),
        meta:{showFooter:true}
    },
    {
        path:"/search/:keyword?",
        component: () => import('@/pages/Search'),
        meta:{showFooter:true},
        name:"search"
    },
    {
        path:"/login",
        component: () => import('@/pages/Login'),
        meta:{showFooter:false}
    },
    {
        path:"/register",
        component: () => import('@/pages/Register'),
        meta:{showFooter:false}
    },   
    {
        path: "/addcartsuccess",
        component: () => import('@/pages/AddCartSuccess'),
        name: "addcartsuccess",
        meta:{showFooter:true}
    },
    //购物车页面
    {
        path:"/shopcart",
        component: () => import('@/pages/ShopCart'),
        meta:{showFooter:true}
    },
    //结算界面
    {
        path:"/trade",
        component: () => import('@/pages/Trade'),
        meta:{showFooter:true},
        //路由独享守卫 交易只能从购物车进入
        beforeEnter: (to, from, next) => {
            if (from.path == '/shopcart') {
              next()
            } else {
              next(false)
            }
          }
    },
    {
        path:"/pay",
        component: () => import('@/pages/Pay'),
        meta:{showFooter:true},
        beforeEnter: (to, from, next) => {
            if (from.path == '/trade') {
              next()
            } else {
              next(false)
            }
          }
    },
    {
        path:"/paysuccess",
        component: () => import('@/pages/PaySuccess'),
        meta:{showFooter:true}
    },
    {
        path:"/center",
        component: () => import('@/pages/Center'),
        meta:{showFooter:true},
        children:[
            {
                path:"myorder",
                component: () => import('@/pages/Center/myOrder'),
            },
            {   
                path:"grouporder",
                component: () => import('@/pages/Center/groupOrder'),
            },
            //路由的重定向
            {
                path:"/center",
                redirect:'/center/myorder'
            }
        ]
    },   
    //重定向访问/ 到首页       
    {
        path:'*',
        redirect:"/home"
    }
]